package org.zebra.common.exception;

/**
 * 全局错误码枚举
 * -1 到 - 20  系统异常编码保留
 *
 * @author zhanghongbin
 */
public enum StatusCode implements FailCode {
    SUCCESS(0, "成功"),
    UNKNOWN(-1, "未知错误"),
    PARAMS_CHECK(-2, "参数校验失败"),
    API_VERSION_DEPRECATED(-3, "API接口已弃用"),
    NOT_FOUND(-4, "请求未找到"),
    REPEATED_REQUEST(-5, "重复请求，请稍后重试"),
    INVALID_SIGNATURE(-6, "无效签名"),
    DB_OPERATION(-7, "数据库操作失败"),
    ENCRYPT_FAILED(-8, "解密失败"),
    RATE_LIMIT(-9, "访问过于频繁，请稍后再试"),
    AUTH_FAILED(-10, "认证失败，无法访问系统资源"),
    AUTH_TIMEOUT(-11, "认证超时，无法访问系统资源"),
    PERMISSION_FAILED(-12, "没有访问权限，请联系管理员授权"),
    SMS_FAILED(-13, "短信发送失败，请稍后再试");

    private int code;
    private String msg;

    StatusCode(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    @Override
    public int getCode() {
        return this.code;
    }

    @Override
    public String getMsg() {
        return this.msg;
    }
}
